#include <iostream>
#include <vector>

using namespace std;
class Solution
{
public:
    /**
     * @brief 101110011
     *
     * @param s
     * @return true
     * @return false
     */
    bool checkZeroOnes(string s)
    {
        int mx0 = 0, mx1 = 0;
        char prev = '#'; // 上个字符
        int cnt = 0;
        for (char ch : s)
        {
            // 当前字符与上个字符相等
            if (ch == prev)
            {
                ++cnt;
            }
            // 当前字符与上个字符不相等
            else
            {
                if (prev == '0')
                {
                    mx0 = max(mx0, cnt);
                }
                else if (prev == '1')
                {
                    mx1 = max(mx1, cnt);
                }
                cnt = 1;
            }
            prev = ch;
        }
        // 字符串结尾的连续子串
        if (prev == '0')
        {
            mx0 = max(mx0, cnt);
        }
        else if (prev == '1')
        {
            mx1 = max(mx1, cnt);
        }
        return mx1 > mx0;
    }

    bool checkZeroOnes_1(string s)
    {
        int maxlen1 = 0, maxlen0 = 0;
        int len1 = 0, len0 = 0;
        for (int i = 0; i < s.size(); i++)
        {
            if (s[i] == '1')
            {
                len1++;
                if (s[i + 1] != '1')
                {
                    maxlen1 = max(maxlen1, len1);
                    len1 = 0;
                }
            }
            else
            {
                len0++;
                if (s[i + 1] != '0')
                {
                    maxlen0 = max(maxlen0, len0);
                    len0 = 0;
                }
            }
        }
        return maxlen1 > maxlen0;
    }
};
int main()
{
    Solution s;
    string str = "1101";
    cout << s.checkZeroOnes(str) << endl;
    return 0;
}